home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_jeep_pru.cog < prev    next >
Text File  |  1999-11-15  |  4KB  |  195 lines

  1. # Jones 3D Cog Script
  2. #
  3. # Jeep_PRU.cog
  4. #
  5. # [PKM]    [GGJ] [RT]
  6. #
  7. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  8. #
  9. # ========================================================================================
  10.  
  11. symbols
  12.  
  13.     message        startup
  14.     message        created
  15.     message        activated
  16.     message        callback
  17.  
  18.     sound        someGas=INXJ243.wav                    local
  19.     sound        gasCanOn=jep_gascan_attach.wav        local
  20.     sound        gasCanOff=jep_gascan_detach.wav        local
  21.  
  22.     sound    noJeep0=vl05j09.wav    local        # Sorry, not yet.
  23.     sound    noJeep1=bb11j02.wav    local        # Sorry, not yet.
  24.     sound    noJeep2=inxj088.wav    local        # Nope.
  25.     sound    noJeep3=inxj061.wav    local        # I'm not sure that's a good idea.
  26.  
  27.     thing        jeepPRU                                local
  28.     thing        indy                                local
  29.  
  30.     int            jeepMesh                            local
  31.     int            meshRef                                local
  32.     int            gasCanBin=66                        local
  33.     int            isTakingCan=0                        local
  34.     int            bStartCutscene=0                    local
  35.  
  36.  
  37.     int        bBusy=0                local
  38.     int        newLine=-1            local
  39.     
  40.     int        oldLine0=-1            local
  41.     int        oldLine1=-1            local
  42.     int        oldLine2=-1            local
  43.     
  44.  
  45.     flex        dotProduct                            local
  46.     flex        rightDot                            local
  47.  
  48.     vector        indyVector                            local
  49.     vector        cameraPos                            local
  50.  
  51.     model        jeepGasCan=gascan_bab_jeep.3do        local
  52.  
  53.     keyframe    in_reach=in_pickup_med.key            local
  54.  
  55. end
  56.  
  57. # ========================================================================================
  58.  
  59. code
  60.  
  61. startup:
  62.  
  63.     indy = GetLocalPlayerThing();
  64.     return;
  65.  
  66. created:
  67.     jeepPRU = GetSenderRef();
  68.     jeepMesh = GetMeshByName(jeepPRU, "jeep_body");
  69.     meshRef = SetThingMesh(jeepPRU, jeepMesh, jeepGasCan, 0);
  70.  
  71.     SetThingUserData(jeepPRU, meshRef);
  72.     return;
  73.  
  74. activated:
  75.     indyVector = VectorNorm(VectorSub(GetThingPos(jeepPRU), GetThingPos(indy)));
  76.  
  77.     # Check to see where Indy is standing relative to the jeep
  78.     dotProduct = VectorDot(GetThingLVec(jeepPRU), indyVector);
  79.     rightDot = VectorDot(GetThingRVec(jeepPRU), indyVector);
  80.  
  81.     # Check to see if Indy is positioned near the gas can.
  82.     if ((dotProduct >= 0.904) && (dotProduct <= 0.997) && (rightDot > 0))
  83.     {
  84.         meshRef = GetThingUserData(jeepPRU);
  85.  
  86.         if (meshRef == -1)
  87.         {
  88.             if (GetCurItem(indy) == gasCanBin)
  89.             {
  90.                 isTakingCan = 0;
  91.                 bStartCutscene = 1;
  92.  
  93.                 SendMessage(GetCogByIndex(0), user1);
  94.             }
  95.         }
  96.         else
  97.         {
  98.             isTakingCan = 1;
  99.             bStartCutscene = 1;
  100.  
  101.             SendMessage(GetCogByIndex(0), user0);
  102.         }
  103.     }
  104.  
  105.     if (bStartCutscene)
  106.     {
  107.         if (MakeMeStop() == -1)
  108.         {
  109.             bStartCutscene = 0;
  110.             return;
  111.         }
  112.         # RT: Fixed bug #7626
  113.         DeselectWeaponWait(indy);
  114.  
  115.         SetExtCamOffset('0.2 0.1 0.1');
  116.  
  117.         # RT: Also forgot to start the cutscene
  118.         StartCutscene(0);
  119.  
  120.         # RT: Now it's okay to capture indy
  121.         CaptureThing(indy);
  122.         PlayKey(indy, in_reach, 5, 0x12, 0); 
  123.         bStartCutscene = 0;
  124.     }
  125.     else
  126.     {
  127.         if (bBusy) return;
  128.     
  129.         bBusy = 1;
  130.     
  131.         while ((newLine == oldLine0) || (newLine == oldLine1) || (newLine == oldLine2))
  132.         {        
  133.             newLine = RandBetween(0, 3);
  134.         }
  135.         
  136.         oldLine2 = oldLine1;
  137.         oldLine1 = oldLine0;
  138.         oldLine0 = newLine;
  139.     
  140.         PlayVoice(indy, noJeep0[newLine], 1.0, 1);
  141.         bBusy = 0;
  142.         return;
  143.     }
  144.  
  145.     return;
  146.  
  147. callback:
  148.     if (GetParam(1) == 16)
  149.     {
  150.         # Indy is halfway through with his reach animation, so take the can off the jeep, or
  151.         # put it back, as appropriate.
  152.  
  153.         meshRef = GetThingUserData(jeepPRU);
  154.  
  155.         ReleaseThing(indy);
  156.         if (isTakingCan == 1)
  157.         {
  158.             # The gas can is currently attached to the jeep - give it to the player.
  159.  
  160.             RestoreThingMesh(jeepPRU, meshRef);
  161.             SetThingUserData(jeepPRU, -1);
  162.             PlaySoundLocal(gasCanOn, 1.0, 0, 0, 0);
  163.  
  164.             SetInvAvailable(indy, gasCanBin, 1);
  165.             ChangeInv(indy, gasCanBin, 1.0);
  166.             JonesInvItemChanged(gasCanBin);            
  167.  
  168.             SendMessage(GetThingCaptureCog(jeepPRU), user0);
  169.  
  170.             Sleep(1.0);
  171.             PlayVoice(indy, someGas, 1.0, 0);
  172.         }
  173.         else
  174.         {
  175.             # The player is activating us with the gas can - put it back on the jeep.
  176.             jeepMesh = GetMeshByName(jeepPRU, "jeep_body");
  177.             meshRef = SetThingMesh(jeepPRU, jeepMesh, jeepGasCan, 0);
  178.             PlaySoundLocal(gasCanOff, 1.0, 0, 0, 0);
  179.  
  180.             SetThingUserData(jeepPRU, meshRef);
  181.  
  182.             ChangeInv(indy, gasCanBin, -1.0);
  183.             SetInvAvailable(indy, gasCanBin, 0);
  184.  
  185.             SendMessage(GetThingCaptureCog(jeepPRU), user1);
  186.         }
  187.     }
  188.  
  189.     RestoreExtCam();
  190.     ClearActorFlags(indy, 0x200000);
  191.     EndCutscene();
  192.  
  193.     return;
  194. end
  195.